package com.yujistu.utils;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;

/**
 * Created by S3YOGA on 2015/11/3.
 */
public class JsonConverter {

    public Gson gson = new Gson();

    public <T> T paresJson(String s, Class<T> clz) {
        T result = null;
        try{
            Logger.d("JsonConverter:s" + s);
            result = gson.fromJson(s, clz);
        }catch (Exception e){
            e.printStackTrace();
        }
        if(result != null){
            return result;
        }else {
            return JSON.parseObject(s, clz);
        }
    }
}
